package com.usian.wemedia.controller.v1;

import com.usian.apis.wemedia.WmNewsControllerApi;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.media.dtos.WmNewsDto;
import com.usian.model.media.dtos.WmNewsPageReqDto;
import com.usian.model.media.pojos.WmNews;
import com.usian.wemedia.service.WmNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * ClassName: WmNewController
 * Author:   WGG
 * Date:    2022-11-2022/11/17-11:55
 * Version: 1.0
 * Description:
 */
@RestController
@RequestMapping("/wemedia/api/v1/news")
public class WmNewsController implements WmNewsControllerApi {


    @Autowired
    private WmNewsService wmNewsService;

    @Override
    @PostMapping("/list")
    public ResponseResult list(@RequestBody WmNewsPageReqDto dto) {
        return wmNewsService.list(dto);
    }

    @Override
    @PostMapping("/submit")
    public ResponseResult submit(@RequestBody WmNewsDto dto) {

            return wmNewsService.submit(dto);
    }

    @Override
    @GetMapping("/one/{id}")
    public ResponseResult one(@PathVariable Integer id) {
        return wmNewsService.one(id);
    }

    @Override
    @GetMapping("/getOne/{id}")
    public WmNews getOneWmNews(@PathVariable Integer id) {
        return wmNewsService.getOneWmNews(id);
    }

    @Override
    @GetMapping("/del_news/{id}")
    public ResponseResult delNews(@PathVariable Integer id) {
        return wmNewsService.delNews(id);
    }

    @Override
    @PostMapping("/down_or_up")
    public ResponseResult downOrUp(@RequestBody WmNews wmNews) {
        return wmNewsService.downOrUp(wmNews);
    }

    @Override
    @PostMapping("/listWmNews")
    public ResponseResult listWmNews(@RequestBody WmNewsDto wmNewsDto) {
        return wmNewsService.listWmNews(wmNewsDto);
    }

    @Override
    @PostMapping("/updateStatusAndReason")
    public ResponseResult updateStatusAndReason(@RequestBody WmNews wmNews) {
        return wmNewsService.updateStatusAndReason(wmNews);
    }

    @Override
    @GetMapping("/findIds")
    public List<Integer> findIds() {
        return wmNewsService.findIds();
    }

    @Override
    @GetMapping("/findByStatusIds")
    public List<Integer> findByStatusIds() {
        return wmNewsService.findByStatusIds();
    }


}
